﻿@model etracks.Web.EnvironmentReadOnlyViewModel

@using (Html.BeginForm("Edit", "Environment", FormMethod.Post, new { @class = "form-horizontal" }))
{
    <div class="form-group">
        <h3 class="col-sm-offset-2 col-sm-8">Environment</h3>
    </div>

    <div class="form-group">
        <label for="input_name" class="col-sm-2 control-label">Environment Name</label>
        <div class="col-sm-8">
            <p class="form-control-static">@Model.Name</p>
        </div>
    </div>

    <div class="form-group">
        <label for="input_name" class="col-sm-2 control-label">
            Resource(s)
            @Html.ActionLink("Add", "Add", "Resource", null, null)
        </label>
        <div class="col-sm-8">
            @if (Model.ResourceList.Count > 0)
            {
                foreach (etracks.Web.ResourceReadOnlyViewModel r in Model.ResourceList)
                {
                    <p class="form-control-static">@Html.ActionLink(string.Format("{0} - {1}", r.ResourceType, r.Name), "View", "Resource", new { id = r.Id }, null)</p>
                }
            }
            else
            {
                <p class="form-control-static">No resource assigned to this environment.</p>
            }
            
        </div>
    </div>

    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-8">
            @Html.ActionLink("Environment List", "List", "Environment", new { id = Model.ProjectId }, new { @class = "btn btn-default" })
        </div>
    </div>
}